import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JLabel;
import java.awt.BorderLayout;

public class InStereo extends JFrame
{
	private static final long serialVersionUID = 999;

    private StereoRectPanel thePanel;

    private BorderLayout bl;

    private JLabel tip;

    public InStereo()
    {
        setTitle("Stereo Vision");

        thePanel = new StereoRectPanel();
        
        getContentPane().add(thePanel);

		addWindowListener(new WindowAdapter() 
		{
			@Override
            public void windowClosing(WindowEvent e)
			{
				System.exit(0);
			}
		});

		buildMenu();
		pack();

    }
    
	private void buildMenu()
	{
		// Instantiates JMenuBar, JMenu,
		// and JMenuItem.
		JMenuBar mb = new JMenuBar();
		JMenu filemnu = new JMenu("File");
		JMenuItem runitm = new JMenuItem("Run");
		JMenuItem exititm = new JMenuItem("Exit");
		//Closes the application from the Exit 
		//menu item.
		exititm.addActionListener(new ActionListener()
		{
			public void actionPerformed(ActionEvent e)
			{
				System.exit(0);
			}
             
		});// Ends method

        runitm.addActionListener(new StereoRectPanel());
 
		//Adds the item to the menu object
		filemnu.add(runitm);
		filemnu.add(exititm);
		//Adds the menu object with item
		//onto the menu bar
		mb.add(filemnu); 
		//Sets the menu bar in the frame
		setJMenuBar(mb);
	}

    public static void main(String[] args)
    {
        InStereo frame = new InStereo();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setSize(500,300);
        frame.setVisible(true);
    }

}

